package com.qf.config;

import com.alibaba.druid.pool.DruidDataSource;

import javax.sql.DataSource;

/**
 * @author sunyamei
 * @version V1.0
 * @Project spring_demo
 * @Package com.qf.config
 * @Description:
 * @Date 2022/7/12 19:57
 */
//@Configuration
//@ComponentScan(basePackages = "com.qf")
//@PropertySource("classpath:druid.properties")
public class SpringConfig {

    //    @Value("${druid.driverClassName}")
    private String driverClass;
    //    @Value("${druid.url}")
    private String url;
    //    @Value("${druid.username}")
    private String username;
    //    @Value("${druid.password}")
    private String password;

    //    @Bean
    public DataSource getDataSource(){
        DruidDataSource dataSource=new DruidDataSource();
        dataSource.setDriverClassName(driverClass);
        dataSource.setUrl(url);
        dataSource.setUsername(username);
        dataSource.setPassword(password);
        return dataSource;
    }
}
